<template>
	<view class="details">
		<view class="title">
			<text>隐患基础信息</text>
		</view>
		<view class="yhbox">
			<view class="list">
				<text class="one">隐患名称</text>
				<text class="two">{{obj.yhmc}}</text>
			</view>
			<view class="list">
				<text class="one">隐患位置</text>
				<text class="two">{{obj.dyName}}</text>
			</view>
			<view class="list">
				<text class="one">治理类型</text>
				<text class="two">{{obj.zllx == 0 ? '即查即改' : '限期整改' }}</text>
			</view>
			<view class="list">
				<text class="one">预案名称</text>
				<text class="two">{{obj.yaName}}</text>
			</view>
			<view class="list">
				<text class="one">隐患类型</text>
				<text
					class="two">{{obj.yhlx == 1 ? '安全' : obj.yhlx == 2 ? '工艺' : obj.yhlx == 3 ? '电气': obj.yhlx == 4 ? '仪表': obj.yhlx == 5 ? '消防': obj.yhlx == 6 ? '总图': obj.yhlx == 7 ? '设备': '其他' }}</text>
			</view>
			<view class="list">
				<text class="one">整改资金</text>
				<text class="two">{{obj.zgzj?obj.zgzj:'--'}}</text>
			</view>
			<view class="list">
				<text class="one">隐患等级</text>
				<text class="two">{{obj.yhdj == 0 ? '一般隐患' : '重大隐患' }}</text>
			</view>
			<view class="list">
				<text class="one">验收时间</text>
				<text class="two"v-if="obj.yssj">{{obj.yssj.toString().substring(0,4)}}-{{obj.yssj.toString().substring(4,6)}}-{{obj.yssj.toString().substring(6,8)}} {{obj.yssj.toString().substring(8,10)}}:{{obj.yssj.toString().substring(10,12)}}</text>
			</view>
		</view>
		<view class="title">
			<text>隐患描述</text>
		</view>
		<view class="yhms">
			<textarea v-model="obj.yhms" height="300" disabled disabledColor='#fff'
				style="background:#fff;margin-bottom: 30px;width: 100%!important;border-radius: 16rpx;padding: 24px;box-sizing: border-box;"></textarea>
		</view>
		<view class="title">
			<text>原因分析</text>
		</view>
		<view class="fxyy">
			<textarea v-model="obj.yyfx" height="300" disabled disabledColor='#fff'
				style="background:#fff;margin-bottom: 30px;width: 100%!important;border-radius: 16rpx;padding: 24px;box-sizing: border-box;"></textarea>
		</view>
		<view class="title">
			<text>控制措施</text>
		</view>
		<view class="fxyy">
			<textarea v-model="obj.kzcs" height="300" disabled disabledColor='#fff'
				style="background:#fff;margin-bottom: 30px;width: 100%!important;border-radius: 16rpx;padding: 24px;box-sizing: border-box;"></textarea>
		</view>
		<view class="title">
			<text>人物环管</text>
		</view>
		<view class="figure">
			<view class="figure-top">
				<view class="left">
					<text>人物管理分类</text>
				</view>
				<view class="right">
					<text>{{obj.rwglfl}}</text>
				</view>
			</view>
			<view class="figure-foot">
				<view class="left">
					<text>发生环节</text>
				</view>
				<view class="right">
					<text>{{obj.fshj}}</text>
				</view>
			</view>
		</view>
		<view class="title">
			<text>整改人信息</text>
		</view>
		<view class="figure">
			<view class="figure-foot">
				<view class="left">
					<text>责任整改人</text>
				</view>
				<view class="right">
					<text>{{obj.zgzrrName}}</text>
				</view>
			</view>
			<view class="figure-foot">
				<view class="left">
					<text>隐患治理期限</text>
				</view>
				<view class="right">
					<text>{{obj.yhzlqx.toString().substring(0,4)}}-{{obj.yhzlqx.toString().substring(4,6)}}-{{obj.yhzlqx.toString().substring(6,8)}} {{obj.yhzlqx.toString().substring(8,10)}}:{{obj.yhzlqx.toString().substring(10,12)}}</text>
				</view>
			</view>
		</view>
		<view class="title">
			<text>验收人信息</text>
		</view>
		<view class="figure">
			<view class="figure-foot">
				<view class="left">
					<text>验收人</text>
				</view>
				<view class="right">
					<text>{{obj.ysrName}}</text>
				</view>
			</view>
			<view class="figure-foot">
				<view class="left">
					<text>验收日期</text>
				</view>
				<view class="right">
					<text class="two"v-if="obj.yssj">{{obj.yssj.toString().substring(0,4)}}-{{obj.yssj.toString().substring(4,6)}}-{{obj.yssj.toString().substring(6,8)}} {{obj.yssj.toString().substring(8,10)}}:{{obj.yssj.toString().substring(10,12)}}</text>
				</view>
			</view>
		</view>
		<view class="title">
			<text>隐患照片</text>
		</view>
		<view style="display: flex;">
			<view class="yhzp" v-for="(item,index) in imgUrl" :key="index">
				<image :src="item" mode=""></image>
			</view>
		</view>
		<view class="btn">
			<u-button type="primary" @click="feedback" text="整改反馈"></u-button>
		</view>
	</view>
</template>

<script>
	import {
		pagefxList
	} from '../../api/yhzl.js'
	import {
		URL
	} from '@/api/public.js'
	export default {
		data() {
			return {
				imgUrl: [],
				value: '请输入...',
				value1: '请输入...',
				obj: {},
				queryParams: {
					pageNum: 1,
					pageSize: 10000,
				},
				dyName: null
			}
		},
		onLoad(obj) {
			this.obj = JSON.parse(obj.details)
			this.getList()
			this.imgUrl = this.obj.yhzp.split(',')
			console.log(this.obj);
		},
		methods: {
			feedback() {
				uni.navigateTo({
					url: `/pages/correctiveFeedback/correctiveFeedback?details=${JSON.stringify(this.obj)}`
				})
			},
			getList() {
				pagefxList(this.queryParams).then((res) => {
					let dyName = null
					res.data.list.forEach(element => {
						if (this.obj.dy == element.riskEventId) {
							dyName = element.riskEventName
						}
					});
					this.dyName = dyName
				})
			}
		}
	}
</script>

<style lang="scss">
	.details {
		width: 100vw;
		// height: calc(100vh - 88rpx);
		background-color: #F6F6F6;
		padding: 40rpx 24rpx 24rpx;
		box-sizing: border-box;

		.title {
			margin-left: 48rpx;
			font-size: 28rpx;
			color: #999999;
			margin-bottom: 16rpx;
		}

		.yhbox {
			width: 702rpx;
			// height: 650rpx;
			background-color: #fff;
			border-radius: 16rpx;
			padding: 0 48rpx;
			box-sizing: border-box;
			margin-bottom: 40rpx;

			.list {
				display: flex;
				// width: 702rpx;
				width: 100%;
				height: 108rpx;
				line-height: 108rpx;
				border-bottom: 1rpx #eeeeee solid;

				.one {
					font-size: 28rpx;
					color: #999999;
				}

				.two {
					flex: 1;
					margin-left: 64rpx;
					font-size: 28rpx;
					color: #666666;
				}
			}

			.wu {
				border-bottom: none;
			}
		}

		.yhms {
			width: 702rpx;
			height: 300rpx;
			border-radius: 16rpx;
			margin-bottom: 40rpx;
		}

		.fxyy {
			width: 702rpx;
			height: 300rpx;
			border-radius: 16rpx;
			margin-bottom: 40rpx;
		}
	
	.figure {
			width: 702rpx;
			background-color: #fff;
			border-radius: 16rpx;
			padding: 0 48rpx;
			box-sizing: border-box;
			margin-bottom: 40rpx;

			.figure-top {
				display: flex;
				height: 108rpx;
				line-height: 108rpx;

				.left {
					width: 180rpx;
					text-align-last: left;
					font-size: 28rpx;
					color: #999999;
				}

				.right {
					margin-left: 24rpx;
					font-size: 28rpx;
					color: #666666;
				}
			}

			.figure-foot {
				display: flex;
				height: 108rpx;
				line-height: 108rpx;

				.left {
					width: 180rpx;
					text-align-last: left;
					font-size: 28rpx;
					color: #999999;
				}

				.right {
					margin-left: 24rpx;
					font-size: 28rpx;
					color: #666666;
				}
			}
		}

		.yhzp {
			width: 330rpx;
			height: 220rpx;
			background-color: #fff;
			border-radius: 8rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			margin-right: 30rpx;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.btn {
			margin-top: 40rpx;
		}
	}
</style>
